package com.yunhe.option.service.base;

import com.yunhe.common.exception.ArgumentErrorException;
import com.yunhe.common.exception.ObjectNotFoundException;
import com.yunhe.common.exception.UniqueConstraintsException;
import com.yunhe.common.model.PageParam;
import com.yunhe.option.domain.base.Enum;
import com.yunhe.option.domain.base.ImportEnumItems;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @ClassName EnumSerivce
 * @Description TODO
 * @Author HeTao
 * @Date 2021/2/26 14:29
 * @Version 1.0
 **/
public interface EnumService {
    /**
     * 新增枚举
     * @param enums
     * @return
     * @throws UniqueConstraintsException
     * @throws ArgumentErrorException
     */
    @Transactional(rollbackFor = Exception.class, transactionManager = "transactionManager")
    Enum createEnum(Enum enums) throws UniqueConstraintsException, ArgumentErrorException;

    /**
     * 编辑枚举
     * @param enums
     * @return
     */
    @Transactional(rollbackFor = Exception.class, transactionManager = "transactionManager")
    Enum updateEnum(Enum enums) throws ArgumentErrorException, UniqueConstraintsException;

    /**
     * 删除枚举
     * @param id
     */
    @Transactional(rollbackFor = Exception.class, transactionManager = "transactionManager")
    void delete(Long id) throws ArgumentErrorException;

    Enum getEnumById(Long id) throws ArgumentErrorException;

    Iterable<Enum> getEnumByCondition(PageParam pageParam);

    @Transactional(rollbackFor = Exception.class, transactionManager = "transactionManager")
    List<String> importEnumAndItems(List<ImportEnumItems> importEnumItems) throws UniqueConstraintsException, ObjectNotFoundException, ArgumentErrorException;

    int getTotalCount();

    Iterable<Enum> findAll();
}
